package com.axjy.base;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication(scanBasePackages = {"com.axjy.base","com.axjy.comm.config"})
@EnableDiscoveryClient //启用服务注册
@MapperScan(basePackages ="com.axjy.base.mapper" )
@EnableFeignClients  //启用远程调用
public class BaseApp {

    public static void main(String[] args) {
        SpringApplication.run(BaseApp.class,args);
    }


    @Bean
    @LoadBalanced //开启负载均衡
    public RestTemplate restTemplate(){
        return new RestTemplateBuilder().build();
    }
}
